<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    var str = '1234567'
    function format(str) {
        let s = ''
        let count = 0
        for (let i = str.length - 1; i >= 0; i--) {
            s = str[i] + s
            count++
            if (count % 3 == 0 && i != 0) {
                s = ',' + s
            }
        }
        return s
    }
    var res = console.log(toMoneyStr(str));


</script>